<?php
//后台公共模块，主要用于显示框架页面和公有功能
class PublicAction extends Action {

    public function top() {
        $this->assign('admin_name',session('admin_name'));
        $this->assign('admin_level',session('admin_level'));
        $this->display();
    }

    public function left() {
        $this->display();
    }

    public function right() {
        $this->display();
    }

    public function upload() {
        $this->display();
    }

    //上传文件
    public function upfile() {
        import('ORG.Util.UploadFile');
        import('ORG.Util.Image');
        if($_GET['type'] == 'ckimg') {
            $up = new UploadFile('upload', 100000);
            $path = '/'.$up->getLinkPath();
            $ckefn = $_GET['CKEditorFuncNum'];
            echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($ckefn,\"$path\",'');</script>";
        } else if($_GET['type'] == 'banner'){
            $up = new UploadFile('myfile', 100000);
            $path = $up->getLinkPath();
            $img = new Image($path);
            if($_GET['t'] == 1) $img->thumb(1000, 60);
            if($_GET['t'] == 2) $img->thumb(320, 195);
            $img->output();
            alertAndClose('图片上传成功!', $path, 'add', 'pic');
        } else {
            $up = new UploadFile('myfile', 100000);
            $path = $up->getLinkPath();
            $img = new Image($path);
            $img->thumb(150, 100);
            $img->output();
            alertAndClose('图片上传成功!', $path, 'add', 'thumbnail');
        }
    }

    public function checkCode() {
        import('Think.Include.CheckCode');
        $checkCode = new CheckCode();
        $checkCode->output();
    }


}

?>